package org.iks.store.business.mapper;

import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import org.apache.ibatis.annotations.Mapper;
import org.apache.ibatis.annotations.Param;
import org.iks.store.business.entity.SessionEntity;
import org.iks.store.business.vo.session.SessionMessageVo;
import org.iks.store.business.vo.session.SessionVo;

import java.util.List;

/**
 * Author kzou
 * Date 2024/2/13
 * Description:
 */
@Mapper
public interface SessionMapper extends BaseMapper<SessionEntity> {

    /**
     * 查看会话与最近一条消息记录
     */
    List<SessionMessageVo> querySessionMessageList(String userAccount);

    SessionVo querySession(Integer sessionId);

    int queryMemberCount(Integer sessionId);

    /**
     * 未读消息数量
     */
    int queryUnreadCount(
            @Param("sessionId") Integer sessionId,
            @Param("account") String account
    );

    /**
     * 查询默认会话
     */
    SessionEntity queryUserDefaultSession(
            @Param("userAccount") String userAccount,
            @Param("account") String account
    );

}
